package com.bruan.d1_file;

import java.io.File;
import java.lang.reflect.Field;

public class FileTest1 {
    public static void main(String[] args) {
        //分隔符写法
        File f = new File("D:/Desktop/hhh.jpg");
        File f1 = new File("D:\\Desktop\\hhh.jpg");
        File f2 = new File("D:"+File.separator+"Desktop"+File.separator+"hhh.jpg");
        System.out.println(f.length());
        System.out.println(f1.length());
        System.out.println(f2.length());
        //File可以指向一个不存在的路径
        File file = new File("D:/Desktop/dadasda.jpg");
        System.out.println(file.length());
        System.out.println(file.exists());
        //要定位的文件在模块中，如何得到
        File f4 = new File("D:\\CODE\\CodeOfJava\\javasepromax\\file-io-app\\bruan.txt");
        System.out.println(f4.toString()+f4.length());
        //相对路径 默认从工程文件中寻找
        File f5 = new File("file-io-app\\bruan.txt");
        System.out.println(f5.toString()+f5.length());


    }
}
